import { MyResponse } from './net';

export function copyNewRes<T>(res: MyResponse<T>): MyResponse<T> {
  // res.code,res.msg,res.data,res.$originalData
  return new MyResponse<T>({
    code: res.code,
    msg: res.msg,
    data: res.data,
    $originalData: res.$originalData,
  });
}

export function createLoadingRes<T = any>(data?: any): MyResponse<T> {
  return new MyResponse<T>({
    code: -1000,
    data,
    msg: '正在加载...',
    $originalData: null,
  });
}
